package model;

import java.awt.Point;
import java.util.Vector;

import various.Constants;


/**
 * Cette classe est tres importante, c'est dans celle-ci que nous definissons les tuiles de base une par une, par definir j'entends que c'est ici que nous
 * allons affecter pour chaque tuile ses caracteristique, a savoir ce qu'elle comporte, chemin ou ville ouverte, fermee, champs, abbey etc.
 * Nous allons aussi lui affectee les differents points sur lesquels pourront etres poser des pions.
 * Pour finir nous avons defini les differents pions chacun ayant une couleur distincte.
 * Comme vous pouvez le voir elle implement abstractfactory, car nous considérons que la base est une extension en elle-meme.
 * @author kn - cm
 *
 */
public class BaseExpansion implements AbstractFactoryExpansion {

	ModelTownCK t;
	ModelTownCK tCl;
	ModelFieldCK f ;
	ModelPathCK p ;
	ModelPathCK pCl ;
	ModelAbbeyCK ab ;
	
	public BaseExpansion(){
		this.t = new ModelTownCK(false);
		this.tCl = new ModelTownCK(true);
		this.f = new ModelFieldCK();
		this.p = new ModelPathCK(false);
		pCl = new ModelPathCK(true);
		this.ab = new ModelAbbeyCK();
	}

	@Override
	public Vector<ModelTile> makeTiles() {
		Vector<ModelTile> vmt = new Vector<ModelTile>();
		try{
		//tile-a
		ModelConstraint arraya[] = {f, f, f
				, f, f, f
				, f, pCl, f
				, f, f, f};
		ModelTile a = new ModelTileCK(arraya, false, "Images/Tiles/tile-a.jpg");
		Vector<ModelPosition> aPos = new Vector<ModelPosition>();
		aPos.add(new ModelPositionCK(new Point(50,50),ab));
		aPos.add(new ModelPositionCK(new Point(15,15),f));
		aPos.add(new ModelPositionCK(new Point(45,85),p));
		((ModelTileCK) a).setPosition(aPos);
		
		//tile-b
		ModelConstraint arrayb[] = {f, f, f
				, f, f, f
				, f, f, f
				, f, f, f};
		ModelTile b = new ModelTileCK(arrayb, false, "Images/Tiles/tile-b.jpg");
		Vector<ModelPosition> bPos = new Vector<ModelPosition>();
		bPos.add(new ModelPositionCK(new Point(50,50),ab));
		bPos.add(new ModelPositionCK(new Point(15,15),f));
		((ModelTileCK) b).setPosition(bPos);

		//tile-c
		ModelConstraint arrayc[] = {t, t, t
				, t, t, t
				, t, t, t
				, t, t, t};
		ModelTile c = new ModelTileCK(arrayc, false, "Images/Tiles/tile-c.jpg");
		Vector<ModelPosition> cPos = new Vector<ModelPosition>();
		cPos.add(new ModelPositionCK(new Point(50,50),t));
		((ModelTileCK) c).setPosition(bPos);

		//tile-e
		ModelConstraint arraye[] = {tCl,tCl,tCl
				, f, f, f
				, f, f, f
				, f, f, f};
		ModelTile e = new ModelTileCK(arraye, false, "Images/Tiles/tile-e.jpg");
		Vector<ModelPosition> ePos = new Vector<ModelPosition>();
		ePos.add(new ModelPositionCK(new Point(50,15),t));
		ePos.add(new ModelPositionCK(new Point(50,50),f));
		((ModelTileCK) e).setPosition(ePos);


		//tile-f
		ModelConstraint arrayff[] = {f, f, f
				, t, t, t
				, f, f, f
				, t, t, t};
		ModelTile ff = new ModelTileCK(arrayff, false, "Images/Tiles/tile-f.jpg");
		Vector<ModelPosition> fPos = new Vector<ModelPosition>();
		fPos.add(new ModelPositionCK(new Point(50,50),t));
		fPos.add(new ModelPositionCK(new Point(50,15),f));
		fPos.add(new ModelPositionCK(new Point(50,85),t));
		((ModelTileCK) ff).setPosition(fPos);


		//tile-g
		ModelConstraint arrayg[] = {t, t, t
				, f, f, f
				, t, t, t
				, f, f, f};
		ModelTile g = new ModelTileCK(arrayg, false, "Images/Tiles/tile-g.jpg");
		Vector<ModelPosition> gPos = new Vector<ModelPosition>();
		gPos.add(new ModelPositionCK(new Point(50,50),t));
		gPos.add(new ModelPositionCK(new Point(15,50),f));
		gPos.add(new ModelPositionCK(new Point(85,50),f));
		((ModelTileCK) g).setPosition(gPos);


		//tile-h
		ModelConstraint arrayh[] = {f, f, f
				,tCl,tCl,tCl
				, f, f, f
				, tCl,tCl,tCl};
		ModelTile h = new ModelTileCK(arrayh, false, "Images/Tiles/tile-h.jpg");
		Vector<ModelPosition> hPos = new Vector<ModelPosition>();
		hPos.add(new ModelPositionCK(new Point(50,50),f));
		hPos.add(new ModelPositionCK(new Point(15,50),t));
		hPos.add(new ModelPositionCK(new Point(85,50),t));
		((ModelTileCK) h).setPosition(hPos);

		
		//tile-i
		ModelConstraint arrayi[] = {f, f, f
				,tCl,tCl,tCl
				, tCl,tCl,tCl
				, f, f, f};
		ModelTile i = new ModelTileCK(arrayi, false, "Images/Tiles/tile-i.jpg");
		Vector<ModelPosition> iPos = new Vector<ModelPosition>();
		iPos.add(new ModelPositionCK(new Point(50,50),f));
		iPos.add(new ModelPositionCK(new Point(50,85),t));
		iPos.add(new ModelPositionCK(new Point(85,50),t));
		((ModelTileCK) i).setPosition(iPos);

		//tile-j
		ModelConstraint arrayj[] = {tCl,tCl,tCl
				,f, p, f
				, f, p, f
				, f, f, f};
		ModelTile j = new ModelTileCK(arrayj, false, "Images/Tiles/tile-j.jpg");
		Vector<ModelPosition> jPos = new Vector<ModelPosition>();
		jPos.add(new ModelPositionCK(new Point(50,85),p));
		jPos.add(new ModelPositionCK(new Point(50,15),t));
		jPos.add(new ModelPositionCK(new Point(15,50),f));
		((ModelTileCK) j).setPosition(jPos);
		
		//tile-k
		ModelConstraint arrayk[] = {f, p, f
				,tCl,tCl,tCl
				, f, f, f
				, f, p, f};
		ModelTile k = new ModelTileCK(arrayk, false, "Images/Tiles/tile-k.jpg");
		Vector<ModelPosition> kPos = new Vector<ModelPosition>();
		kPos.add(new ModelPositionCK(new Point(50,15),p));
		kPos.add(new ModelPositionCK(new Point(50,80),f));
		kPos.add(new ModelPositionCK(new Point(85,50),t));
		((ModelTileCK) k).setPosition(kPos);
		
		//tile-l
		ModelConstraint arrayl[] = {f, pCl, f
				,tCl,tCl,tCl
				, f, pCl, f
				, f, pCl, f};
		ModelTile l = new ModelTileCK(arrayl, false, "Images/Tiles/tile-l.jpg");
		Vector<ModelPosition> lPos = new Vector<ModelPosition>();
		lPos.add(new ModelPositionCK(new Point(50,15),p));
		lPos.add(new ModelPositionCK(new Point(15,50),p));
		lPos.add(new ModelPositionCK(new Point(50,85),p));
		lPos.add(new ModelPositionCK(new Point(7,7),f));
		lPos.add(new ModelPositionCK(new Point(85,50),t));
		((ModelTileCK) l).setPosition(lPos);
		
		//tile-m
		ModelConstraint arraym[] = {tCl,tCl,tCl
				,f, f, f
				, f, f, f
				, tCl,tCl,tCl};
		ModelTile m = new ModelTileCK(arraym, false, "Images/Tiles/tile-m.jpg");
		Vector<ModelPosition> mPos = new Vector<ModelPosition>();
		mPos.add(new ModelPositionCK(new Point(15,15),t));
		mPos.add(new ModelPositionCK(new Point(80,50),f));
		((ModelTileCK) m).setPosition(mPos);
		
		//tile-n
		ModelConstraint arrayn[] = {tCl,tCl,tCl
				,f, f, f
				, f, f, f
				, tCl,tCl,tCl};
		ModelTile n = new ModelTileCK(arrayn, false, "Images/Tiles/tile-n.jpg");
		Vector<ModelPosition> nPos = new Vector<ModelPosition>();
		nPos.add(new ModelPositionCK(new Point(15,15),t));
		nPos.add(new ModelPositionCK(new Point(80,50),f));
		((ModelTileCK) n).setPosition(nPos);
		
		//tile-o
		ModelConstraint arrayo[] = {tCl,tCl,tCl
				,f, p, f
				, f, p, f
				, tCl,tCl,tCl};
		ModelTile o = new ModelTileCK(arrayo, false, "Images/Tiles/tile-o.jpg");
		Vector<ModelPosition> oPos = new Vector<ModelPosition>();
		oPos.add(new ModelPositionCK(new Point(15,15),t));
		oPos.add(new ModelPositionCK(new Point(50,50),f));
		oPos.add(new ModelPositionCK(new Point(85,50),t));
		((ModelTileCK) o).setPosition(oPos);
		
		//tile-p
		ModelConstraint arraypp[] = {tCl,tCl,tCl
				,f, p, f
				, f, p, f
				, tCl,tCl,tCl};
		ModelTile pp = new ModelTileCK(arraypp, false, "Images/Tiles/tile-p.jpg");
		Vector<ModelPosition> pPos = new Vector<ModelPosition>();
		pPos.add(new ModelPositionCK(new Point(15,15),t));
		pPos.add(new ModelPositionCK(new Point(50,50),f));
		pPos.add(new ModelPositionCK(new Point(85,50),t));
		((ModelTileCK) pp).setPosition(pPos);
		
		//tile-q
		ModelConstraint arrayq[] = {t, t, t
				,t, t, t
				, f, f, f
				, t, t, t};
		ModelTile q = new ModelTileCK(arrayq, false, "Images/Tiles/tile-q.jpg");
		Vector<ModelPosition> qPos = new Vector<ModelPosition>();
		qPos.add(new ModelPositionCK(new Point(50,20),t));
		qPos.add(new ModelPositionCK(new Point(50,85),f));
		((ModelTileCK) q).setPosition(qPos);
		
		//tile-r
		ModelConstraint arrayr[] = {t, t, t
				,t, t, t
				, f, f, f
				, t, t, t};
		ModelTile r = new ModelTileCK(arrayr, false, "Images/Tiles/tile-r.jpg");
		Vector<ModelPosition> rPos = new Vector<ModelPosition>();
		rPos.add(new ModelPositionCK(new Point(50,20),t));
		rPos.add(new ModelPositionCK(new Point(50,85),f));
		((ModelTileCK) r).setPosition(rPos);
		
		//tile-s
		ModelConstraint arrays[] = {t, t, t
				,t, t, t
				, f, p, f
				, t, t, t};
		ModelTile s = new ModelTileCK(arrays, false, "Images/Tiles/tile-s.jpg");
		Vector<ModelPosition> sPos = new Vector<ModelPosition>();
		sPos.add(new ModelPositionCK(new Point(50,20),t));
		sPos.add(new ModelPositionCK(new Point(50,85),p));
		sPos.add(new ModelPositionCK(new Point(70,90),f));
		((ModelTileCK) s).setPosition(sPos);
		
		//tile-t
		ModelConstraint arraytt[] = {t, t, t
				,t, t, t
				, f, p, f
				, t, t, t};
		ModelTile tt = new ModelTileCK(arraytt, false, "Images/Tiles/tile-t.jpg");
		Vector<ModelPosition> tPos = new Vector<ModelPosition>();
		tPos.add(new ModelPositionCK(new Point(50,20),t));
		tPos.add(new ModelPositionCK(new Point(50,85),p));
		tPos.add(new ModelPositionCK(new Point(70,90),f));
		((ModelTileCK) tt).setPosition(tPos);
		
		//tile-u
		ModelConstraint arrayu[] = {f, p, f
				,f, f, f
				,f, p, f
				,f, f, f};
		ModelTile u = new ModelTileCK(arrayu, false, "Images/Tiles/tile-u.jpg");
		Vector<ModelPosition> uPos = new Vector<ModelPosition>();
		uPos.add(new ModelPositionCK(new Point(50,50),p));
		uPos.add(new ModelPositionCK(new Point(15,50),f));
		((ModelTileCK) u).setPosition(uPos);
		
		//tile-v
		ModelConstraint arrayv[] = {f, f, f
				,f, f, f
				, f, p, f
				, f, p, f};
		ModelTile v = new ModelTileCK(arrayv, false, "Images/Tiles/tile-v.jpg");
		Vector<ModelPosition> vPos = new Vector<ModelPosition>();
		vPos.add(new ModelPositionCK(new Point(50,15),f));
		vPos.add(new ModelPositionCK(new Point(45,85),p));
		((ModelTileCK) v).setPosition(vPos);
		
		//tile-w
		ModelConstraint arrayw[] = {f, f, f
				,f, pCl, f
				, f, pCl, f
				, f, pCl, f};
		ModelTile w = new ModelTileCK(arrayw, false, "Images/Tiles/tile-w.jpg");
		Vector<ModelPosition> wPos = new Vector<ModelPosition>();
		wPos.add(new ModelPositionCK(new Point(50,15),f));
		wPos.add(new ModelPositionCK(new Point(15,50),p));
		wPos.add(new ModelPositionCK(new Point(85,50),p));	
		wPos.add(new ModelPositionCK(new Point(45,85),p));
		((ModelTileCK) w).setPosition(wPos);
		
		//tile-x
		ModelConstraint arrayx[] = {f, pCl, f
				,f, pCl, f
				, f, pCl, f
				, f, pCl, f};
		ModelTile x = new ModelTileCK(arrayx, false, "Images/Tiles/tile-x.jpg");
		Vector<ModelPosition> xPos = new Vector<ModelPosition>();
		xPos.add(new ModelPositionCK(new Point(50,15),p));
		xPos.add(new ModelPositionCK(new Point(15,50),p));
		xPos.add(new ModelPositionCK(new Point(85,50),p));	
		xPos.add(new ModelPositionCK(new Point(45,85),p));
		((ModelTileCK) x).setPosition(xPos);
		
		vmt.addElement(a);
		vmt.addElement(b);
		vmt.addElement(c);
		vmt.addElement(e);
		vmt.addElement(ff);
		vmt.addElement(g);
		vmt.addElement(h);
		vmt.addElement(i);
		vmt.addElement(j);
		vmt.addElement(k);
		vmt.addElement(l);
		vmt.addElement(m);
		vmt.addElement(n);
		vmt.addElement(o);
		vmt.addElement(q);
		vmt.addElement(r);
		vmt.addElement(s);
		vmt.addElement(tt);
		vmt.addElement(u);
		vmt.addElement(v);
		vmt.addElement(w);
		vmt.addElement(x);
		}catch (Exception e) {
			System.out.println(e.getLocalizedMessage());
		}
		

		return vmt;

	}
	
	public ModelTile makeFirstTile() {
		ModelTile d = null;
		try{
		ModelConstraint arrayd[] = {f, p, f
				, tCl, tCl, tCl
				, f, p, f
				, f, f, f};
		 d = new ModelTileCK(arrayd, false, Constants.linkfirstTile);
		}catch (Exception e) {
			System.out.println(e.getLocalizedMessage());
		}
		return d;
	}

	public Vector<ModelPawn> makePawns() {
		Vector<ModelPawn> vmp = new Vector<ModelPawn>();
		try{
		ModelPawn p1 = new ModelPawnCK(1, "Images/Pawns/red-pawn.png");
		ModelPawn p2 = new ModelPawnCK(1, "Images/Pawns/green-pawn.png");
		ModelPawn p3 = new ModelPawnCK(1, "Images/Pawns/grey-pawn.png");
		ModelPawn p4 = new ModelPawnCK(1, "Images/Pawns/blue-pawn.png");
		ModelPawn p5 = new ModelPawnCK(1, "Images/Pawns/white-pawn.png");
		ModelPawn p6 = new ModelPawnCK(1, "Images/Pawns/pink-pawn.png");

		vmp.add(p1);
		vmp.add(p2);
		vmp.add(p3);
		vmp.add(p4);
		vmp.add(p5);
		vmp.add(p6);
		}catch (Exception e) {
			System.out.println(e.getLocalizedMessage());
		}
		
		return vmp;
	}


	@Override
	public String getNameExpansion() {
		// TODO Auto-generated method stub
		return null;
	}	
}
